package com.iyohei.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.iyohei.entry.LeaveWord;
import com.iyohei.entry.LeaveWord2;
import com.iyohei.mapper.LWordMapper;

@Service
public class LeaveWordServiceImpl implements LeaveWordService {

	@Autowired
	LWordMapper lWordDao;
	
	
	public List<LeaveWord2> getLWordList(long id) {
		List<LeaveWord2> lWord2List= new ArrayList();
		List<LeaveWord> lWordList = lWordDao.getLWordList(id);
		for (LeaveWord lWord : lWordList) {
			LeaveWord2 lWord2 =new LeaveWord2();
			lWord2.setId(lWord.getId());
			lWord2.setLAdmire(lWord.getLAdmire());
			lWord2.setLName(lWord.getLName());
			lWord2.setLNote(lWord.getLNote());
			lWord2.setLNumber(lWord.getLNumber());
			lWord2.setLTime(lWord.getLTime());
			lWord2.setParentId(lWord.getParentId());
			List<LeaveWord> lWordList2 = lWordDao.getLWordList(lWord.getId());
			lWord2.setlWordList(lWordList2);
			lWord2List.add(lWord2);
		}
		return lWord2List;
	}

}
